#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

double fact(int n) {
    if (n == 0) return 1;
    else return n * fact(n - 1);
}

double factsum(int n) {
    double sum = 0;
    for (int i = 1; i <= n; i++) {
        sum += fact(i);
    }
    return sum;
}

int main() {
    int n;

    scanf("%d", &n);
    printf("fact(%d) = %.0f\n", n, fact(n));
    printf("sum = %.0f\n", factsum(n));

    return 0;
}
